package net.app.zoneland.db.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import java.util.Date;

/**
 * @Description 处理填充数据
 * @Author cjb
 * @CreateTime 2020/12/13 10:39
 * @Version: 1.0
 */
public class MethodHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("gmt_create", new Date(), metaObject);
        this.setFieldValByName("createBy", "admin", metaObject);
        this.setFieldValByName("gmtModified ", new Date(), metaObject);
        this.setFieldValByName("updateBy", "admin", metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("gmtModified", new Date(), metaObject);
        this.setFieldValByName("updateBy", "admin", metaObject);
    }
}
